
PROJ = winvn
PROJFILE = makefile.std
DEBUG = 1

NMAKEBSC1  = set
NMAKEBSC2  = nmake
BRFLAGS  = /o $(PROJ).bsc
BROWSE  = 1
BSCMAKE  = bscmake
SBRPACK  = sbrpack
CC  = cl
CFLAGS_G  = /AL /W3 /G2 /GA /GEf /Zp /BATCH /FR$*.sbr
CFLAGS_D  = /f /Od /Zi /Gs
CFLAGS_R  = /f- /Oe /Og /Os /Gs
CXX  = cl
CXXFLAGS_G  = /G2 /W3 /GA /GEf /Zp /BATCH /FR$*.sbr
CXXFLAGS_D  = /f /Zi /Od /Gs
CXXFLAGS_R  = /f- /Oe /Og /Os /Gs
MAPFILE_D  = NUL
MAPFILE_R  = NUL
LFLAGS_G  =  /BATCH /ONERROR:NOEXE
LFLAGS_D  = /CO /NOFARCALL
LFLAGS_R  = /NOFARCALL
LLIBS_R = /NOD:LLIBCE LLIBCEW
LLIBS_D = /NOD:LLIBCE LLIBCEW
LLIBS_G  = LIBW.LIB
LINKER  = link
ILINK  = ilink
LRF  = echo > NUL
ILFLAGS  = /a /e
RC  = rc
RCFLAGS1 =
RCFLAGS2 = -K
CVFLAGS  = /25 /2 /B
PACK_SBRS  = 1

DEF_FILE = winvnstd.def

FILES  = winvnstd.def wvsckstd.c winvn.c wvblock.c wvcncm.c wvfile.c\
	wvgroup.c wvheader.c wvpost.c wvscreen.c wvusenet.c wvutil.c\
	wvart.c wvlist.c winvn.rc wvmail.c wvauth.c shellsor.c wvprint.c \
	wvmapi.c headarry.c wvcrypt.c wvattach.c wvcoding.c wvtxtblk.c \
	wvcodewn.c

OBJS  = winvn.obj wvblock.obj wvcncm.obj wvfile.obj wvgroup.obj\
	wvheader.obj wvpost.obj wvscreen.obj wvsckstd.obj wvusenet.obj\
	wvutil.obj wvprint.obj wvart.obj wvlist.obj wvmail.obj wvauth.obj\
	SHELLSOR.obj ini_news.obj wvmapi.obj headarry.obj wvcrypt.obj \
	wvattach.obj wvcoding.obj wvtxtblk.obj wvcodewn.obj

# DOS command-line length stupidity.  Check rest of makefile if you change!

RCS1 = winvn.c wvblock.c wvcncm.c wvfile.c wvgroup.c wvheader.c headarry.c
RCS2 = wvpost.c wvscreen.c wvusenet.c wvutil.c ini_news.c  wvsckstd.c
RCS3 = wvart.c wvlist.c wvmail.c wvauth.c shellsor.c wvprint.c wvmapi.c wvcrypt.c
RCS4 = winvn.h wvglob.h wvdlg.h wvmapi.h winvn.rc winvn.dlg
RCS5 = wvattach.c wvcoding.c wvtxtblk.c wvcodewn.c

RCSFILES = $(RCS1) $(RCS2) $(RCS3) $(RCS4) $(RCS5)

LIBS_EXT  =
LIBS  = $(LIBS_EXT)
RESS  = winvn.res
SBRS  = winvn.sbr wvblock.sbr wvcncm.sbr wvfile.sbr wvgroup.sbr\
	wvheader.sbr wvpost.sbr wvscreen.sbr wvsckstd.sbr wvusenet.sbr\
	wvutil.sbr wvart.sbr wvlist.sbr wvmail.sbr wvauth.sbr shellsor.sbr\
		  wvprint.sbr ini_news.sbr headarry.sbr wvcrypt.sbr

all: $(PROJ).exe

!IF $(DEBUG)
CFLAGS = $(CFLAGS_G) $(CFLAGS_D)
!ELSE
CFLAGS = $(CFLAGS_G) $(CFLAGS_R)
!ENDIF

.SUFFIXES: .obj .sbr .res .c .rc

# Rules to create files from RCS database

$(RCSFILES):
	co $@

version:
	echo static char version_string[] = >version.c
	echo "This is " WINVN_VERSION "\n">>version.c
	ident $(RCS1) | mawk -f version.awk >>version.c
	ident $(RCS2) | mawk -f version.awk >>version.c
	ident $(RCS3) | mawk -f version.awk >>version.c
	ident $(RCS4) | mawk -f version.awk >>version.c
	ident $(RCS5) | mawk -f version.awk >>version.c
	echo ; >>version.c

# rule for making object files
.c.obj:
  $(CC) /c $(CFLAGS) /Fo$*.obj $*.c

# rule for making source code browser files
.c.sbr:
  $(CC) /Zs $(CFLAGS) /Fo$*.sbr $*.c

checkout: $(RCSFILES)
	co $(RCS1)
	co $(RCS2)
	co $(RCS3)
	co $(RCS4)
	co $(RCS5)

winvn.obj : winvn.c wvglob.h winvn.h winundoc.h\
	 wvdlg.h

winvn.sbr : winvn.c wvglob.h winvn.h winundoc.h\
	 wvdlg.h

wvblock.obj : wvblock.c wvglob.h winvn.h wvdlg.h

wvblock.sbr : wvblock.c wvglob.h winvn.h wvdlg.h

wvcncm.obj : wvcncm.c wvglob.h winvn.h wvdlg.h

wvcncm.sbr : wvcncm.c wvglob.h winvn.h wvdlg.h

wvfile.obj : wvfile.c wvglob.h winvn.h winundoc.h\
	wvdlg.h

wvfile.sbr : wvfile.c wvglob.h winvn.h winundoc.h\
	wvdlg.h

wvprint.obj : wvprint.c wvglob.h winvn.h winundoc.h\
	wvdlg.h

wvprint.sbr : wvprint.c wvglob.h winvn.h winundoc.h\
	wvdlg.h

wvgroup.obj : wvgroup.c winundoc.h wvglob.h winvn.h\
	wvdlg.h

wvgroup.sbr : wvgroup.c winundoc.h wvglob.h winvn.h\
	wvdlg.h

wvheader.obj : wvheader.c wvglob.h winvn.h winundoc.h\
	wvdlg.h

wvheader.sbr : wvheader.c wvglob.h winvn.h winundoc.h\
	wvdlg.h

wvpost.obj : wvpost.c wvglob.h winvn.h winundoc.h\
	wvdlg.h

wvpost.sbr : wvpost.c wvglob.h winvn.h winundoc.h\
	wvdlg.h

wvscreen.obj : wvscreen.c wvglob.h winvn.h wvdlg.h

wvscreen.sbr : wvscreen.c wvglob.h winvn.h wvdlg.h

wvsckstd.obj : wvsckstd.c wvglob.h winvn.h wvdlg.h

wvsckstd.sbr : wvsckstd.c wvglob.h winvn.h wvdlg.h

wvusenet.obj : wvusenet.c winundoc.h wvglob.h winvn.h\
	wvdlg.h

wvusenet.sbr : wvusenet.c winundoc.h wvglob.h winvn.h\
	wvdlg.h

wvutil.obj : wvutil.c wvglob.h winvn.h winundoc.h\
	wvdlg.h

wvutil.sbr : wvutil.c wvglob.h winvn.h winundoc.h\
	wvdlg.h

wvart.obj : wvart.c winundoc.h wvglob.h winvn.h\
	wvdlg.h

wvart.sbr : wvart.c winundoc.h wvglob.h winvn.h\
	wvdlg.h

wvlist.obj : wvlist.c wvglob.h winvn.h winundoc.h\
	wvdlg.h

wvlist.sbr : wvlist.c wvglob.h winvn.h winundoc.h\
	wvdlg.h

wvmail.obj : wvmail.c wvglob.h winvn.h winundoc.h\
	wvdlg.h

wvmail.sbr : wvmail.c wvglob.h winvn.h winundoc.h\
	wvdlg.h

wvauth.obj : wvauth.c

wvauth.sbr : wvauth.c

shellsor.obj : shellsor.c

shellsor.sbr : shellsor.c

ini_news.obj : ini_news.c

ini_news.sbr : ini_news.c

headarry.obj : headarry.c wvglob.h winvn.h

headarry.sbr : headarry.c wvglob.h winvn.h

wvcrypt.obj : wvcrypt.c

wvcrypt.sbr : wvcrypt.c

winvn.res : winvn.rc winvn.h winvn.ico wvgroup.ico\
	wvart.ico wvpost.ico dish.ico

$(PROJ).bsc : $(SBRS)
	$(BSCMAKE) @<<
$(BRFLAGS) $(SBRS)
<<

$(PROJ).exe : $(DEF_FILE) $(OBJS) $(LIBS) $(RESS)
	-$(NMAKEBSC1) MAKEFLAGS=
	-$(NMAKEBSC2) $(NMFLAGS) -f $(PROJFILE) $(PROJ).bsc
!IF $(DEBUG)
	$(LRF) @<<$(PROJ).lrf
$(RT_OBJS: = +^
) $(OBJS: = +^
)
$@
$(MAPFILE_D)
$(LIBS: = +^
) +
$(LLIBS_G: = +^
) +
$(LLIBS_D: = +^
)
$(DEF_FILE) $(LFLAGS_G) $(LFLAGS_D);
<<
!ELSE
	$(LRF) @<<$(PROJ).lrf
$(RT_OBJS: = +^
) $(OBJS: = +^
)
$@
$(MAPFILE_R)
$(LIBS: = +^
) +
$(LLIBS_G: = +^
) +
$(LLIBS_R: = +^
)
$(DEF_FILE) $(LFLAGS_G) $(LFLAGS_R);
<<
!ENDIF
	$(LINKER) @$(PROJ).lrf
	$(RC) $(RCFLAGS2) $(RESS) $@

.rc.res :
	$(RC) $(RCFLAGS1) /r /fo $@ $<


run: $(PROJ).exe
	WX $(WXFLAGS) $(PROJ).exe $(RUNFLAGS)

debug: $(PROJ).exe
	WX /p $(WXFLAGS) CVW $(CVFLAGS) $(PROJ).exe $(RUNFLAGS)

clean:
   rm -f *.exe
   rm -f *.obj
   rm -f *.sbr
   rm -f *.bsc
   rm -f *.dll
   rm -f *.lib
   rm -f *.res
   rm -f *~

#
# YOU must supply the RELEASE string for this.
# example:
# nmake -f makefile.std release RELEASE=V3

release: $(RCSFILES)
   rcs -n$(RELEASE): $(RCS1)
   rcs -n$(RELEASE): $(RCS2)
   rcs -n$(RELEASE): $(RCS3)
   rcs -n$(RELEASE): $(RCS4)
   rcs -n$(RELEASE): $(RCS5)

dist: $(RCSFILES)
   $(MAKE) -f $(PROJFILE) clean
   rm -f ../winvnsrc.zip
   zip ../winvnsrc.zip *.*
